package com.beiding.listener;

import com.beiding.config.EmailAmqpConfig;
import com.beiding.pojo.Email;
import com.beiding.service.EmailService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class EmailListener {

    private EmailService emailService;

    public EmailListener(EmailService emailService) {
        this.emailService = emailService;
    }

    @RabbitListener(queues = EmailAmqpConfig.SEND_EMAIL_QUEUE)
    public void send(Email email)
    {
        emailService.send(email);
    }

}
